package com.wwy.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author 王伟羽
 * @date 2024/3/13 17:42
 */
@SpringBootConfiguration
public class PublishConfiguration {

    @Bean
    public FanoutExchange getFanoutExchange(){
        return new FanoutExchange("publish_exchange_one");
    }

    @Bean
    public Queue getQueueOne(){
        return new Queue("publish_queue_one");
    }

    @Bean
    public Queue getQueueTwo(){
        return new Queue("publish_queue_two");
    }

    @Bean
    public Binding getBindingOne(){
        return BindingBuilder.bind(getQueueOne()).to(getFanoutExchange());
    }



    @Bean
    public Binding getBindingTwo(){
        return BindingBuilder.bind(getQueueTwo()).to(getFanoutExchange());
    }

}
